package com.s59.config;


import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectExchangeConfig {
    @Bean
    public Queue queueDemo(){
        return new Queue("s59-queue1");
    }
    @Bean
    public Queue queueDemo1(){
        return new Queue("s59-queue2");
    }

    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("s59-directExchange");
    }

    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("s59-topicExchange");
    }

    @Bean
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("s59-fanoutExchange");
    }
    @Bean
    public Binding binding1(){
        return BindingBuilder.bind(queueDemo()).to(directExchange()).with("red");
    }
    @Bean
    public Binding binding2(){
        return BindingBuilder.bind(queueDemo1()).to(directExchange()).with("green");
    }
    @Bean
    public Binding binding3(){
        return BindingBuilder.bind(queueDemo()).to(topicExchange()).with("#.red.#");
    }
    @Bean
    public Binding binding4(){
        return BindingBuilder.bind(queueDemo1()).to(topicExchange()).with("#.green.#");
    }
    @Bean
    public Binding binding5(){
        return BindingBuilder.bind(queueDemo()).to(fanoutExchange());
    }
    @Bean
    public Binding binding6(){
        return BindingBuilder.bind(queueDemo1()).to(fanoutExchange());
    }
}
 